<?php

class BlockBuilder{
	
	protected $block;
	public function getBlock(){
		return $this->block;
	}
	public function createBlock($objectClass,$oid,$objectParent,$properties,$text){
		
		$this->block = new $objectClass($objectParent);
		
		$this->buildObjectClass($objectClass);
		$this->buildObjectId($oid);
		$this->buildObjectParent($objectParent);
		$this->buildTextBlock($text);
		
		if($properties)
			foreach($properties as $property => $value){
				$this->buildProperty($property,$value);
			}
	}
	public function buildObjectClass($objectClass){
		$this->block->objectClass = $objectClass; 
	}
	public function buildObjectId($oid){
		$this->block->oid = $oid;
	}
	public function buildObjectParent($objectParent){
		$this->block->objectParent = & $objectParent; 	
	}
	public function buildProperty($property,$value){
		$this->block->$property = $value;
	}
	public function buildTextBlock($text){
		$this->block->block = $text;
	}
}
?>